package com.maila.xiaoaoschool.api;

import android.content.Context;

import com.maila.xiaoaoschool.net.NetWork;
import com.maila.xiaoaoschool.net.VolleyInterface;
import com.maila.xiaoaoschool.util.Constants;

import java.util.HashMap;

/**
 * Created by mark on 2017/12/8.
 */

public class FindApi extends NetWork{
    public static final String URL_XIAOAO_FIND = Constants.URL_ROOT_XIAOAO + "/index.php?ctrl=mapixiaoao"; //版本服务器地址

    public FindApi(Context ctx, VolleyInterface listener) {
        super(ctx, listener);
    }

    /**
     * 笑傲商城分类
     */
    public void getXiaoMallclass() {
        requestGet(URL_XIAOAO_FIND, "xiaoao_shop_type");
    }

    /**
     * 笑傲商城商品列表
     * @param typeid
     * @param page
     * @param size
     */
    public void getXiaoMallgoods(String typeid,  int page, int size) {
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("typeid", typeid);
        query.put("page", page);
        query.put("size", size);
        requestPost(URL_XIAOAO_FIND, "xiao_shop_goods", query);
    }

    /**
     * 获取每日一文
     */
    public void getXiaoArt() {
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("page", 1);
        query.put("size", 1);
        requestPost(URL_XIAOAO_FIND, "meiwen", query);
    }

    /**
     * 获取个人积分
     */
    public void getSelfScore() {
        requestGet(URL_XIAOAO_FIND, "score");
    }

    /**
     * 获取积分商品
     * @param page
     * @param size
     */
    public void getscoregoods(int page,int size) {
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("page", page);
        query.put("size", size);
        requestGet(URL_XIAOAO_FIND, "gift", query);
    }

    /**
     * 提交积分商城订单
     * @param giftid
     * @param address_id
     */
    public void submit_scoreorder(String giftid,String  address_id){
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("giftid", giftid);
        query.put("address_id", address_id);
        requestPost(URL_XIAOAO_FIND, "giftorder", query);
    }

    /**
     * 获取跑腿订单
     * @param address_id
     * @param cost
     * @param receive_address
     * @param num
     * @param goodname
     */
    public  void submit_express_order(String address_id,String cost,String receive_address,String  num,String  goodname){
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("cost", cost);
        query.put("address_id", address_id);
        query.put("receive_address", receive_address);
        query.put("num", num);
        query.put("goodname", goodname);
        requestPost(URL_XIAOAO_FIND, "pao_order", query);
    }
    /**
     * 获取跑腿订单列表
     * @param page
     * @param size
     */
    public  void get_express_order_list(int page,int size) {
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("page", page);
        query.put("size", size);
        requestGet(URL_XIAOAO_FIND, "pao_order", query);
    }
    /**
     * 取快递 订单提交
     * @param cost
     * @param address_id
     * @param receive_address
     * @param num
     * @param note
     * @param spec
     */
    public  void  toTakexpress(String cost,String address_id,String receive_address,String num,String  note,String spec){
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("cost", cost);
        query.put("address_id", address_id);
        query.put("receive_address", receive_address);
        query.put("num", num);
        query.put("beizhu", note);
        query.put("spec", spec);
        requestPost(URL_XIAOAO_FIND, "pao_receive", query);
    }
    /**
     * 取消跑腿订单
     * @param ordersn
     * @param type
     */
    public void del_express_order(String ordersn,int type){
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("ordersn", ordersn);
        query.put("type", type);
        requestPost(URL_XIAOAO_FIND, "pao_order", query);
    }

    /**
     *发现 新闻滚动
     */
    public void get_news_list(){
        requestGet(URL_XIAOAO_FIND, "news", null);
    }

    /**
     * 获取 活动列表
     * @param page
     * @param size
     */
    public void get_action_list(int page,int size){
        HashMap<String, Object> query = new HashMap<String, Object>();
        query.put("page", page);
        query.put("size", size);
        requestPost(URL_XIAOAO_FIND, "action", query);
    }


}
